home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _8BAEE474CF0E46A586F43E18920DAC82 < prev    next >
Encoding:
Extensible Markup Language  |  2003-11-05  |  8.5 KB  |  261 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:RHHandlerDb="http://ehelp.com/RHHandlerDb" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="msxsl RHHandlerDb html">
  3.  
  4. <xsl:output method="xml" cdata-section-elements="programlisting" encoding="ISO-8859-1" indent="yes"/>
  5.  
  6. <xsl:param name="rhc.not.to.chunk.longdesc" select="1" />
  7.  
  8. <msxsl:script language="JScript" implements-prefix="RHHandlerDb">
  9. function StrToNode( str )
  10. {
  11.     var objFTDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
  12.     objFTDoc.loadXML(str) ;
  13.       return objFTDoc.documentElement;
  14. }
  15. </msxsl:script>
  16.  
  17. <xsl:template match="comment()">    
  18.     <xsl:choose>
  19.         <xsl:when test="substring(.,1,16) = '[RH.HTML.OBJECT]'">
  20.             <xsl:copy-of select="RHHandlerDb:StrToNode(substring(.,17))" />
  21.         </xsl:when>
  22.         <xsl:when test="substring(.,1,16) = '[RH.HTML.RML_10]'">
  23.             <xsl:copy-of select="RHHandlerDb:StrToNode(substring(.,17))" />
  24.         </xsl:when>
  25.         <!--xsl:when test="substring(.,1,7) = '<ROBOML'">
  26.             <xsl:copy-of select="RHHandlerDb:StrToNode(string(.))" />
  27.         </xsl:when-->
  28.         <xsl:otherwise>
  29.             <xsl:copy />
  30.         </xsl:otherwise>
  31.     </xsl:choose>
  32. </xsl:template>
  33.  
  34. <xsl:template match="@role">
  35.     <xsl:choose>
  36.         <xsl:when test="substring(.,1,4) = 'RHC.'">
  37.             <xsl:call-template name="RHC.Role">
  38.                 <xsl:with-param name="rolestr" select="." />
  39.             </xsl:call-template>
  40.         </xsl:when>
  41.         <xsl:otherwise>
  42.             <xsl:apply-templates />
  43.         </xsl:otherwise>
  44.     </xsl:choose>
  45. </xsl:template>
  46.  
  47. <xsl:template match="/article[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'html']" priority = "1">
  48.     <xsl:variable name="toc.params">
  49.         <xsl:call-template name="find.path.params">
  50.             <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  51.         </xsl:call-template>
  52.     </xsl:variable>
  53.     <xsl:apply-templates/>
  54.     <xsl:call-template name="process.chunk.footnotes"/>
  55. </xsl:template>
  56.  
  57. <xsl:template match="section[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'div']">
  58.     <div xmlns="http://www.w3.org/1999/xhtml">
  59.         <xsl:if test="@id">
  60.             <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  61.         </xsl:if>
  62.         <xsl:apply-templates select="@role"/>
  63.         <xsl:apply-templates/>
  64.     </div>
  65. </xsl:template>
  66.  
  67. <xsl:template match="section[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'noscript']">
  68.     <noscript xmlns="http://www.w3.org/1999/xhtml">
  69.         <xsl:if test="@id">
  70.             <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  71.         </xsl:if>
  72.         <xsl:apply-templates select="@role"/>
  73.         <xsl:apply-templates/>
  74.     </noscript>
  75. </xsl:template>
  76.  
  77. <xsl:template match="citation[substring(@role,1,4)='RHC.']">
  78.     <cite xmlns="http://www.w3.org/1999/xhtml">
  79.         <xsl:if test="@id">
  80.             <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  81.         </xsl:if>
  82.         <xsl:apply-templates select="@role"/>
  83.         <xsl:apply-templates/>
  84.     </cite>
  85. </xsl:template>
  86.  
  87. <xsl:template match="quote[substring(@role,1,4)='RHC.']">
  88.     <q xmlns="http://www.w3.org/1999/xhtml">
  89.         <xsl:if test="@id">
  90.             <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  91.         </xsl:if>
  92.         <xsl:apply-templates select="@role"/>
  93.         <xsl:apply-templates/>
  94.     </q>
  95. </xsl:template>
  96.  
  97. <xsl:template match="phrase[substring(@role,1,4)='RHC.']">
  98.     <xsl:call-template name="convertToStoredElement">
  99.         <xsl:with-param name="defaultElement" select="'span'" />
  100.     </xsl:call-template>
  101. </xsl:template>
  102.  
  103. <xsl:template match="emphasis[substring(@role,1,4)='RHC.']">
  104.     <xsl:call-template name="convertToStoredElement">
  105.         <xsl:with-param name="defaultElement" select="'em'" />
  106.     </xsl:call-template>
  107. </xsl:template>
  108.  
  109. <xsl:template match="literal[substring(@role,1,4)='RHC.']">
  110.     <xsl:call-template name="convertToStoredElement">
  111.         <xsl:with-param name="defaultElement" select="'tt'" />
  112.     </xsl:call-template>
  113. </xsl:template>
  114.  
  115. <xsl:template name="convertToStoredElement">
  116.     <xsl:param name="defaultElement" select="''" />
  117.  
  118.     <xsl:if test="substring(@role, 1, 4) = 'RHC.'">
  119.         <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
  120.         <xsl:variable name="elementName">
  121.             <xsl:choose>
  122.                 <xsl:when test="$original_tag != ''">
  123.                     <xsl:value-of select="$original_tag" />
  124.                 </xsl:when>
  125.                 <xsl:otherwise>
  126.                     <xsl:value-of select="$defaultElement" />
  127.                 </xsl:otherwise>
  128.             </xsl:choose>
  129.         </xsl:variable>
  130.         <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
  131.             <xsl:if test="@id">
  132.                 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  133.             </xsl:if>
  134.             <xsl:apply-templates select="@role" />
  135.             <xsl:apply-templates/>
  136.         </xsl:element>
  137.     </xsl:if>
  138. </xsl:template>
  139.  
  140. <xsl:template match="*[@role='RHC.DUMMY']" priority="2">
  141.     <xsl:apply-templates />
  142. </xsl:template>
  143.  
  144. <xsl:template name="RHC.Role">
  145. <xsl:param name="rolestr" />
  146.     <xsl:if test="substring($rolestr,1,4) = 'RHC.'">
  147.         <xsl:variable name="rhcrole" select="substring($rolestr, 5)" />
  148.         <xsl:choose>
  149.             <xsl:when test="contains($rhcrole,'\')">
  150.                 <xsl:if test="substring-before($rhcrole, '\')">
  151.                     <xsl:attribute name="class">
  152.                         <xsl:value-of select="substring-before($rhcrole, '\')" />
  153.                     </xsl:attribute>
  154.                 </xsl:if>
  155.             </xsl:when>
  156.             <xsl:otherwise>
  157.                 <xsl:if test="$rhcrole">
  158.                     <xsl:attribute name="class">
  159.                         <xsl:value-of select="$rhcrole" />
  160.                     </xsl:attribute>
  161.                 </xsl:if>                
  162.             </xsl:otherwise>
  163.         </xsl:choose>
  164.     </xsl:if>
  165. </xsl:template>
  166.  
  167. <xsl:template match="graphic[starts-with(@role, 'RHC') and (substring-after(@role, '\') = 'hr')]">
  168.     <hr xmlns="http://www.w3.org/1999/xhtml">
  169.         <xsl:if test="@align">
  170.             <xsl:attribute name="align">
  171.                 <xsl:value-of select="@align" />
  172.             </xsl:attribute>
  173.         </xsl:if>
  174.         <xsl:if test="@width">
  175.             <xsl:attribute name="width">
  176.                 <xsl:value-of select="@width" />
  177.             </xsl:attribute>
  178.         </xsl:if>
  179.         <xsl:if test="@depth">
  180.             <xsl:attribute name="size">
  181.                 <xsl:value-of select="@depth" />
  182.             </xsl:attribute>
  183.         </xsl:if>
  184.         <xsl:apply-templates select="@role" />
  185.     </hr>
  186. </xsl:template>
  187.  
  188. <xsl:template name="rhc.longdesc.uri">
  189.     <xsl:param name="mediaobject" select="."/>
  190.  
  191.     <xsl:if test="$html.longdesc">
  192.         <xsl:if test="$mediaobject/textobject[not(phrase)]">
  193.             <xsl:variable name="image-id">
  194.                 <xsl:call-template name="object.id">
  195.                     <xsl:with-param name="object" select="$mediaobject"/>
  196.                 </xsl:call-template>
  197.             </xsl:variable>
  198.             <xsl:value-of select="concat('ld-',$image-id)"/>
  199.         </xsl:if>
  200.     </xsl:if>
  201. </xsl:template>
  202.  
  203. <xsl:template name="rhc.write.longdesc">
  204.     <xsl:param name="mediaobject" select="."/>
  205.     <xsl:param name="longdesc.id" select="''"/>
  206.     <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
  207.         <div xmlns="http://www.w3.org/1999/xhtml" border="1">
  208.             <br xmlns="http://www.w3.org/1999/xhtml" clear="all" />
  209.             <br xmlns="http://www.w3.org/1999/xhtml"/>
  210.             <xsl:attribute name="id">
  211.                 <xsl:value-of select="$longdesc.id" />
  212.             </xsl:attribute>
  213.             <xsl:for-each select="$mediaobject/textobject[not(phrase)]">
  214.                 <xsl:apply-templates select="./*"/>
  215.             </xsl:for-each>
  216.         </div>
  217.     </xsl:if>
  218. </xsl:template>
  219.  
  220. <xsl:template match="beginpage" />
  221.  
  222. <xsl:template match="replaceable[substring(@role, 1, 4) = 'RHC.']" priority="1">
  223.     <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
  224.     <xsl:variable name="elementName">
  225.         <xsl:choose>
  226.             <xsl:when test="$original_tag != ''">
  227.                 <xsl:value-of select="$original_tag" />
  228.             </xsl:when>
  229.             <xsl:otherwise>
  230.                 <xsl:value-of select="'span'" />
  231.             </xsl:otherwise>
  232.         </xsl:choose>
  233.     </xsl:variable>
  234.     <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
  235.         <xsl:apply-templates select="@role" />
  236.         <xsl:apply-templates />
  237.     </xsl:element>
  238. </xsl:template>
  239.  
  240. <xsl:template match="simpara[substring(@role, 1, 4) = 'RHC.']">
  241.     <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
  242.     <xsl:variable name="elementName">
  243.         <xsl:choose>
  244.             <xsl:when test="$original_tag != ''">
  245.                 <xsl:value-of select="$original_tag" />
  246.             </xsl:when>
  247.             <xsl:otherwise>
  248.                 <xsl:value-of select="'span'" />
  249.             </xsl:otherwise>
  250.         </xsl:choose>
  251.     </xsl:variable>
  252.     <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
  253.         <xsl:apply-templates select="@role" />
  254.         <xsl:apply-templates />
  255.     </xsl:element>
  256. </xsl:template>
  257.  
  258. <xsl:template match="calloutlist[substring(@role, 1, 4) = 'RHC.']"  priority="1" />
  259.  
  260. </xsl:stylesheet>
  261.